The present invention relates generally to the field of computer systems, and more specifically relates to providing improved property modifiers operative to format information associated with a computer program and extensible from older to updated versions of the computer program.
Word processing computer application programs are a well-known means for processing text information in a computer system. An example of a word processing program is the Microsoft xe2x80x9cWORDxe2x80x9d program, available from Microsoft Corporation. Many aspects of word processing programs have been extended to other types of computer application programs, for example, spreadsheets, project management programs, graphics programs, database programs, and the like. It is a requirement for these and many other types of computer programs that text, numbers, or other data stored in a document file be displayed in an attractive, formatted manner on a computer monitor, printed via an output device, or otherwise represented.
Many present day computer application programs have the ability to display or output information on output display devices in various formats, often in a form corresponding to the appearance of the data as it will be printed or otherwise output. For example, characters may be printed with any number of fonts, in various sizes, with the characters in boldface, underlined, italicized, centered, in sections, tables, etc.
In many computer application programs, information is represented by a xe2x80x9cdocumentxe2x80x9d. A document is what a user sees and edits. A document can change as the user types, makes formatting changes, adds and deletes text, etc. A document, also called a xe2x80x9cdocument filexe2x80x9d, comprises a number of different data structures or sections that collectively represent a discrete quantity or unit of data for manipulation with the application program. For example, in a word processing program, a document file typically consists of a header defining file ranges for text and formatting information, a text data structure that stores text-based information, a property modifier structure for storing groups of property modifiers and corresponding arguments or parameters representing formatting information for application to the text, and a format structure containing information for linking the text in the data structure to the groups of property modifiers in the property modifier structure. The property modifiers (and their respective arguments) describe formatting applied to characters, paragraphs, sections, tables, and pictures in the document.
In this prior property modifier structure, formatting information is represented by an 8-bit pointer that constitutes a single property modifier or xe2x80x9csprmxe2x80x9d. The sprm indicates an offset address within a format xe2x80x9cdefaultxe2x80x9d table that is stored in conjunction with the executable code of the application program. There is a default table in the executable corresponding to each different type of property, e.g., character, paragraph, table, section and picture. Because the default tables comprise a part of the executable file, they are xe2x80x9cpermanentxe2x80x9d and cannot be modified by the user; these default tables merely serve as reference data containing formatting information that are applied to data items. Each entry in this type of default table consists of an argument size (a xe2x80x9csingle property argumentxe2x80x9d or xe2x80x9cspraxe2x80x9d), a group code (a single property group code or xe2x80x9csgcxe2x80x9d), and a special status bit (xe2x80x9cfSpecxe2x80x9d). The spra indicates the size of parameter value associated with the sprm, which could be a 8-bit byte, a 16-bit word, a 32-bit long, or a variable length array of bytes in the executable. The sgc indicates a type or category of object to be formatted (e.g. character, paragraph, section, etc.). The fSpec status bit indicates whether or not the sprm needs special code to carry out its action.
Each entry in a default table applies a particular single form of formatting to a run of text, in accordance with the type of formatting to be applied, i.e., whether the run of text is a string of characters, a paragraph, a table, etc. In order to apply multiple items of formatting to a selected string of characters, plural sprm entries are provided in the prior property modifier structure. A group of sprm entries indicating a plurality of different formattings applied to a run of characters is indicated as a xe2x80x9cgroup of property modifiers in a listxe2x80x9d or xe2x80x9cgrpprlxe2x80x9d. Each sprm in a group points to a different entry in one or more of the default tables in the executable.
Turning now to a prior text formatting system used by xe2x80x9cMicrosoft WORD FOR WINDOWS 95xe2x80x9d program, formatting information for an example text run will be examined in detail, as shown in Tables 1, 2 and 3. Table 1 generally describes the formatting for a sample text string, xe2x80x9cThe quick brown fox jumped over the lazy dog.xe2x80x9d The typical structure of a document file created in the prior word processing computer program, xe2x80x9cMicrosoft WORD FOR WINDOWS 95xe2x80x9d, is shown in Table 2. This document file contains formatting information and the related structures to support the formatting for the text string shown in Table 1. The typical structure of a default format table contained in executable code of the xe2x80x9cMicrosoft WORD FOR WINDOWS 95xe2x80x9d program is shown in Table 3. This table contains default formatting information that supports the formatting for the text string shown in Table 1.
Referring first to Table 1, the example text string is xe2x80x9cThe quick brown fox jumped over the lazy dogs.xe2x80x9d For this example text string, all text is font size 10, the term xe2x80x9cbrownxe2x80x9d is bold, and the term xe2x80x9coverxe2x80x9d is italic and is two sizes larger than the remaining portion of the text. Consequently, the formatting attributes for this text string include a 10 point font size, bold, italic, and increased font size (by 2 sizes). These format attributes for the text string of Table 1 are defined in the structures of the document file of Table 2 and supported by the format information maintained in the property information array of Table 3.
Referring now to Table 2, a document file for the prior word processing program contains multiple structures including a header, a data structure, a format structure, and a property modifier structure. The header contains general information regarding the document file and defines the text range and the format information range for the data structure and the format structure. A File Character (FC) position represents an offset from the beginning of the document file. Consequently, the header section of the document file is defined by the FC range of 0-1FF. The text range for text maintained in the data structure is 200-22D. The linking information for linking the data of the data structure to the property modifiers of the property modifier structure is maintained within the format structure at 400-42B. For example, for the FC range of 400-407, the text beginning at FC range 200, xe2x80x9cThe quick xe2x80x9d, is associated with the group of property modifiers within the property modifier structure beginning at the FC range of 600.
In the file shown in Table 2, the formatting is specified using single property modifiers (sprms), also called property modifiers. For this xe2x80x9cWORD 95xe2x80x9d program example, the relevant property modifiers are directed to the formatting actions of defining a base font size, increasing this font""s size, bold, and italic. These property modifiers and their values are listed below:
sprmCSize: character formatting to set font size; Value=1
sprmCInc: character formatting to increase font size; Value=2
sprmCBold: character formatting to make text bold; Value=3
sprmCItalic: character formatting to make text italic; Value=4
Each sprm takes an argument, and multiple sprms and their arguments can define formatting for a piece of text.
Groups of property modifiers in a list, also called a grpprl, are stored in the property modifier structure within the file at FC ranges 600-603, 604-609 and 60A-611. A set of grpprls represents the formatting information for the sample text stream xe2x80x9cThe quick brown fox jumped over the lazy dogs.xe2x80x9d For the text xe2x80x9cThe_quick_xe2x80x9d, a grpprl at FC range 600-603 contains just one sprm and argument: sprmCSize, with its argument of 10 (because the text is size 10). For xe2x80x9cbrownxe2x80x9d, a grpprl at FC range 604-609 contains two sprm/argument pairs: sprmCSize, followed by its argument of 10; and sprmCBold, followed by its argument, TRUE. For xe2x80x9coverxe2x80x9d, a grpprl at FC range 60A-611 contains three sprm/argument pairs: sprmCSize, 10; sprmCInc, 2 (increase size by 2); sprmCItalic, TRUE. Given a sprm of Table 2, the associated values for sgc, spra, fSpec, and b, which are stored in the executable of the application program, can be determined by accessing the default table shown in Table 3.
In prior versions of the Microsoft xe2x80x9cWORDxe2x80x9d program, sprm""s were originally restricted to being byte-size. Because of the desire to keep these sprm values small, the sprms did not directly encode information about what property type was modified (for example, character, paragraph, table, etc.) or the size of the argument following the property modifier. Rather, each property modifier was merely an index into the default tables stored in association with the executable file of the application program that themselves encoded the formatting information.
Referring now to Table 3, a default format table maintained within the executable of the prior word processing program can be accessed by using a sprm value as an index to the table. This format table contains the fields for sgc, spra, fSpec, and b values, which are referenced by a corresponding sprm value. For example, the first entry in the default format table is accessed by the sprmCSize(1). This entry contains the following format-related information: sgc=sgcChp(2); spraWord(2); fSpec=FALSE(0); and b=0. The xe2x80x9cbxe2x80x9d value is an offset into a data type structure maintained in dynamic memory and can be used to find the location of a property to modify within that memory structure.
To support an application of the formatting information in the document file of Table 2 and the default table of Table 3, it is necessary to first locate the group of property modifiers associated with the text to be formatted, and then walk or xe2x80x9ctraversexe2x80x9d the group of property modifiers. For the example of the text xe2x80x9coverxe2x80x9d, this text element is referenced by the FC range 21B-21E in the data structure of the file, as shown in Table 2. The format structure indicates that the particular group of property modifiers for the text starting at FC=21B is located within the property modifier structure at FC=60A. The first byte within this group of property modifiers is xe2x80x9c07xe2x80x9d. This first byte defines the number of bytes in the particular group of property modifiers, i.e., seven bytes follow the byte count. The second byte within this group of property modifiers is xe2x80x9c01xe2x80x9d. This is a sprm value, which can be used to index into the default format table shown in Table 3 to get the spra value, that defmes the size of the argument for this property modifier. As shown in Table 3, the spra located at the offset xe2x80x9c01xe2x80x9d of the default table is xe2x80x9cspraWordxe2x80x9d. The third and fourth bytes are xe2x80x9c000Axe2x80x9d, which is the expected Word-sized argument for the property modifier. The fifth byte within this group of property modifiers, xe2x80x9c02xe2x80x9d, is another sprm value. This sprm value is used to index into the default format table to get the spra value xe2x80x9cspraBytexe2x80x9d. The sixth byte is xe2x80x9c02xe2x80x9d, which is the expected Byte-size argument for this property modifier. The seventh byte, xe2x80x9c04xe2x80x9d, is another sprm value. This sprm value is used to index into the default format table to get the spra value xe2x80x9cspraBitxe2x80x9d. The eighth byte is xe2x80x9c01xe2x80x9d, which is the expected Bit-size argument for the property modifier.
Significantly, if an application program did not recognize a sprm value shown in the file of Table 2, then the program would not be able to determine the size of the sprm argument by accessing the default table in the executable. This would prevent the application program from traversing the property modifier structure because the program would not recognize how to skip over the sprm argument to read the subsequent sprm""s and their arguments in the property modifier structure.
With the above-described property modifier approach, a particular problem can arise when programmers are required to add new property modifiers when creating an updated version of the program. Place-holders have been employed in the default tables to reserve space for a predetermined number of property modifiers associated with a particular group code or xe2x80x9csgcxe2x80x9d. When the preallocated space for property modifiers was exhausted as new modifiers were added, a file format change was required to provide a new mechanism for allocating space for property modifiers-in the default property tables. The file format change often caused documents created with the updated version of the program to be unreadable with prior versions of the program.
In prior versions of the Microsoft xe2x80x9cWORDxe2x80x9d program, a single 8-bit integer was used as a sprm. The application program used that value to index into the default table stored in association with the program executable. The result gave detailed information about the property, including the size of the parameter indicated by the spra and the object it should be applied to as derived from the sgc (e.g., character, paragraph, section, etc.). The information stored in the default table also included information needed to modify appropriate in-memory structures holding the actual formatting information. These 8-bit sprm integer values were divided into ranges; the range a property modifier was in determined what kind of object was modified indicated by the sgc, e.g., whether character, paragraph, section, table, or picture. As the program was updated, these ranges were periodically adjusted, and it was discovered that numbers were exhausted in some ranges but there were additional values available in other ranges.
When a new property modifier had to be added in a subsequent version of the application program, the old version did not necessarily have the formatting information in its default property file in the executable. Thus, an older version of the application program, if it attempted to open a document created with a newer version of the program, could not determine the size of a parameter or the object that should be formatted, as the file created with the newer version was incompatible with the older version.
In order to allow for backwards compatible changes to the file format, programmers found it necessary to preallocate slots in the default tables in the executable for future expansion. Once a particular version ran out of preallocated slots, it was then necessary to make a file format changexe2x80x94to increase the number of preallocated slotsxe2x80x94in order to allow new property modifiers. Of course, this preallocation had to be done presently while the programmers were preparing program code for a prior version even before the programmers were instructed to work on the subsequent version! Needless to say, the foresight of many computer programmers was rarely good enough to preserve document compatibility in subsequent versions of the application program.
Another problem associated with the prior art approach resulted from the addition of new sprm table entries. A prior version of the application program could not handle or operate upon with a document created with a subsequent version of the application program because it did not xe2x80x9cknowxe2x80x9d what to do with new sprm values added. In other words, sprms in the document created with the later version could not be handled by the prior version because there was no program code to handle it.
Furthermore, the prior version could not merely skip over the new values because there was no information indicating how big was the xe2x80x9cvaluexe2x80x9d part of the newly added sprm. Although the table entry in the newer version had a spra, the older version did not have a table entry for the new sprm, and therefore could not look up the spra value. Thus, the prior version of the program did not know how many bytes to skip over in the default property table to get to the next sprm. This was because the size of the valuexe2x80x94the spraxe2x80x94was encoded in the table in the executable and not stored in the document itself.
Accordingly, there is a need to provide a method and system that enables documents created with a newer version of an application program to be properly handled by prior versions of the application program in a clean and efficient manner, by providing a mechanism for allowing the prior version of the application program to skip over formatting information that it does not handle. This would allow sites that maintain multiple versions of a particular application program to interoperate and share documents with minimum time lost to conversion between various application versions.
The present invention provides forward-extensible property modifiers for formatting information of a document file in a program module. In particular, the invention entails encoding into the property modifiers items of information that were previously encoded in the default property table(s) stored in the executable portion of the application program. In accordance with the invention, the argument size (spra), group code (sgc), and special indicator value (fSpec) are now encoded in the property modifier or sprm, leaving additional bits for indexing into a new style default table associated with the executable of the program module. Because the argument size (the spra) is directly encoded in the sprm itself, subsequent versions of application programs employing the invention can add new sprm values that prior versions do not handle but can gracefully skip over.
Computer programs are often revised and updated to add new features and capabilities. Some revisions affect the manner in which formatting is applied to information in the document, and require the addition of new property modifiers from time to time. For example, in prior versions of Microsoft""s xe2x80x9cWORDxe2x80x9d application program, it was not always possible to define new property modifiers in such a way that earlier versions of the xe2x80x9cWORDxe2x80x9d application program would be able to utilize (or skip, if necessary) property modifiers added after that version. The inability of earlier versions of a program to xe2x80x9cunderstandxe2x80x9d or process documents created with later versions of the program results in inconvenience to users and inefficiency in organizations that must support multiple versions of the program and/or multiple platforms.
With the present invention, programmers are afforded more freedom and flexibility for adding new types of properties to future versions of the program module. Advantageously, documents created with newer versions of the program can be read and handled by older versions as well. The older versions may not understand or handle formatting provided by new types of property modifiers, but the older versions will still be able to read documents and interpret properties associated with that particular version. Such older versions can skip over and save values of new properties created with the subsequent versions without loss of formatting created with the subsequent versions of the program. Using the present invention, a document created with a later version of an application program can be processed with an earlier version of the computer program without loss of new formatting property modifiers added in the newer version, and enabling the older version to skip property modifiers it does not understand.
To support the formatting of information manipulated by a program module, the present invention provides an improved structure of a file for use in connection with a property information array stored in association with the program module. The property information array maintains formatting information for application to data in a computer file upon which the program module is operative for manipulating. This information describes how to apply formatting. Formatting is typically applied to a character, paragraph, picture, section, table, etc. The improved file structure can include a header, a data structure, a property modifier structure and a data formatting structure. The data structure is useful for storing data elements, such as text. The property modifier structure stores groups of data formatting property modifiers and their arguments, each group representing the appearance of data elements. The data formatting structure stores linking information that associates the data element with corresponding data formatting property modifiers.
Each data formatting property modifier can include a size field, an index field, a data type code field and a special handling data field. The size field can include information indicating the size of the argument for the data formatting property modifier. The index field contains an index into the property information array associated with the program module. The data type code field contains a data type code indicative of a type of data object for formatting to which the data formatting property modifier applies. The special handling data field contains information indicating whether the data formatting property modifier requires a special handling operation.
For another aspect of the present invention, a computer-implemented method of formatting information uses a property modifier structure having at least one group of property modifiers and corresponding arguments. The property modifier structure is maintained within a file of a program module. This file is typically stored in permanent memory, e.g., hard disk drive or CD-ROM. Each property modifier includes a size field having information indicating the size of its property modifier argument and an index field having an index into a property information array stored in association with the program module. The property information array, in contrast, typically contains information on how to apply formatting for a given property modifier and its argument, and can be stored in the executable portion of the program module.
A group of property modifiers associated with selected information for which formatting is to be applied is located within the file and is traversed by the program module. This traversal of the property modifier group can be accomplished by utilizing the information in the size field of the current property modifier to determine the location of the next data formatting property modifier in the group of data formatting property modifiers. Formatting is applied to the selected information by using the index of each property modifier associated with the selected information to access the formatting information maintained in the property information array.
In view of the foregoing, it will be appreciated that the present invention provides an efficient data structure wherein a property modifier associated with data elements, such as a text run, ca store encoded information corresponding to the type of object to receive the formatting, the size of the property modifier""s argument (which follows the property modifier), and an index into the property information array associated with the computer application program executable. Instead of pre-allocating space in the executable portion of a program module, the property modifier itself contains information embedded therein that indicates the size of the parameter of the property modifier. This allows graceful skipping of property modifiers that are not understood by a given version of the program module during a traversal of a property modifier structure in support of an application of formatting to selected information.
These and other features, and advantages of the present invention may be completely understood through the detailed description of the preferred embodiment of the invention provided below and by inspection and review of the accompanying drawing figures.